package com.zego.wawaji.message;

/**
 * 消息类型处理
 */
public class BaseMessage implements IBaseMessage, Cloneable {

    public enum BaseMessageType {
        // 最新定义消息
//        common(CommonMessage.class, 900),//文本消息

        ;

        public Class<? extends BaseMessage> msgClass = null;
        public int msgType;

        BaseMessageType(Class<? extends BaseMessage> msgClass, int msgType) {
            this.msgClass = msgClass;
            this.msgType = msgType;
        }

        public static BaseMessageType valueOf(int msgType) {
            for (BaseMessageType messageType : BaseMessageType.values()) {
                if (messageType.getMsgType() == msgType) {
                    return messageType;
                }
            }
            return null;
        }

        public int getMsgType() {
            return this.msgType;
        }
    }


    @Override
    public BaseMessage parseJson(String jsonStr) {
        return this;
    }

    @Override
    public String getJson(BaseMessage message) {
        return null;
    }

    @Override
    public Object clone() {
        BaseMessage o = null;
        try {
            o = (BaseMessage) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return o;
    }

    public BaseMessage() {
        super();
    }
}